package com.tarena.luban.worker.server.infrastructure.repo.impl;

import com.tarena.luban.worker.server.dao.api.TestWorkerDao;
import com.tarena.luban.worker.server.dao.dos.TestWorkerDO;
import com.tarena.luban.worker.server.domain.bo.TestWorkerBO;
import com.tarena.luban.worker.server.domain.repository.TestWorkerRepository;
import com.tarena.luban.worker.server.protocol.query.TestWorkerQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class TestWorkerRepoImpl implements TestWorkerRepository {
    @Autowired
    private TestWorkerDao testWorkerDao;
    @Override
    public TestWorkerBO testWorker(TestWorkerQuery testWorkerQuery) {
        TestWorkerDO testWorkerDO=testWorkerDao.selectWorkerByUserId(testWorkerQuery);
        //转化DO 成BO 假设worker表格字段就三个 id user_id real_name
        TestWorkerBO testWorkerBO=new TestWorkerBO();
        BeanUtils.copyProperties(testWorkerDO,testWorkerBO);
        return testWorkerBO;
    }
}
